// 涉及到跳转必须在客户端运行
'use client'
import { useRouter } from 'next/navigation'
import React from 'react'

export default function page() {
  // 调用钩子函数
  const router = useRouter()
  return (
    <div>
      <h2>这是新闻列表页</h2>
      <button onClick={() => router.push('/news/detail')}>详情</button>
      <button onClick={() => router.replace('/news/detail')}>销毁跳转</button>
      <button onClick={() => router.back()}>后退</button>
      <button onClick={() => {
        router.refresh()
        console.log('已刷新')
      }}>刷新</button>
    </div>
  )
}
